﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Model;
using System.Configuration;

namespace BusinnessLogic
{
    public class PopulateTeamTreeView
    {
        public List<Team> PopulateTeamlist()
        {
            DataLayer.dlteamlistview DLteamlistfiller = new DataLayer.dlteamlistview();
            DataSet dts = DLteamlistfiller.TeamListViewer();

            List<Team> teamlistview = new List<Team>();


            for (int i = 0; i < dts.Tables[0].Rows.Count; i++)
            {
               // int userid = int.Parse(dts.Tables[0].Rows[i]["UserID"].ToString());
                int teamid = int.Parse(dts.Tables[0].Rows[i]["TeamID"].ToString());
                // string login = dts.Tables[0].Rows[i]["Login"].ToString();
                // string passwoord = dts.Tables[0].Rows[i]["Passwoord"].ToString();

                string name = dts.Tables[0].Rows[i]["Name"].ToString();
                // string voornaam = dts.Tables[0].Rows[i]["FirstName"].ToString();
                // string rolnaam = dts.Tables[0].Rows[i]["Role"].ToString();

                Team newteam = new Team(teamid, name);
                teamlistview.Add(newteam);


            }
            return teamlistview;
        }
    }
}
